<template>
    <div>
        <el-row>
            <el-col :span="1.5"><el-button type="primary" plain>添加</el-button></el-col>
            <el-col :span="1.5"><el-button plain>返回</el-button></el-col>
        </el-row>
        <el-table
            :data="tableData"
            stripe
            style="width: 98%">
            <el-table-column
                prop="date"
                label="检测时间"
                width="140"
                align="center">
            </el-table-column>
            <el-table-column
                prop="result"
                label="核酸结果"
                width="140"
                align="center">
            </el-table-column>
            <el-table-column
                prop="CTresult"
                label="CT结果"
                width="140"
                align="center">
            </el-table-column>
            <el-table-column
                prop="operate"
                label="操作"
                width="140"
                align="center">
                <el-button type="danger" size="mini" @click="showDelete">删除</el-button>
            </el-table-column>
        </el-table>
        <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage4"
            :page-sizes="[1, 2, 3]"
            :page-size="3"
            layout="total, sizes, prev, pager, next, jumper"
            :total="3">
        </el-pagination>
    </div>
</template>
<script>
import request from '@/utils/request'
    export default {
      data() {
        return {
          tableData: null,
          currentPage4: 1,
          form: {},
        }
      },
      created(){
      this.fetchDate()
    },
    methods: {
        fetchDate(){
          request({
              url:'../patint_testrecordlist.json',
              method:'get'
          }).then(response => {
              this.tableData = response.data
          })
        },
        showDelete() {
        this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$message({
            type: 'success',
            message: '删除成功!'
          });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });          
        });
        },
        handleSizeChange(val) {
          console.log(`每页 ${val} 条`);
        },
        handleCurrentChange(val) {
          console.log(`当前页: ${val}`);
        }
    },
   
    }
  </script>
